<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

	<head>
		<meta charset="UTF-8">
		<title>用户信息</title>
		<link rel="stylesheet" th:href="@{/res/css/amazeui.min.css}" />
		<link rel="stylesheet" th:href="@{/res/css/admin.css}" />
		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
		<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
		<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
	</head>

	<body>
		<div class="admin-content-body">
			<div class="am-cf am-padding am-padding-bottom-0">
				<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">用户管理</strong><small></small></div>
			</div>

			<hr>

			<div class="am-g">
				<div class="am-u-sm-12 am-u-md-6">
					<div class="am-btn-toolbar">
						<div class="am-btn-group am-btn-group-xs">
							<button type="button" class="am-btn am-btn-default" data-toggle="modal" data-target="#myModal"><span class="am-icon-plus"></span> 新增会员</button>
							<!-- 按钮触发模态框 -->
							</button>
							<!-- 模态框（Modal） -->
							<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
								<div class="modal-dialog">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
												&times;
											</button>
											<h4 class="modal-title" id="myModalLabel">
												添加新的会员（请注意不要有重名）
											</h4>
										</div>
										<div class="modal-body">
											<form method="post" action="/memberScheduling/addUser">
												<label for="fname">姓名：</label>
												<input type="text" id="fname" name = "MemberName">
												<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
													<input type="submit" class="btn btn-primary" text="添加">

											</form>
										</div>

									</div><!-- /.modal-content -->
								</div><!-- /.modal -->
							</div>
					</div>
				</div>

				</div>
				<div class="am-u-sm-4 am-u-md-1">
					<form action="/memberScheduling/exportExcel">
						<button type="submit" class="btn btn-primary">下载Excel</button>
					</form>
				</div>

				<form action="/memberScheduling/searchOneUser">
				<div class="am-u-sm-12 am-u-md-3">
					<div class="am-input-group am-input-group-sm">
							<input type="text" id="search" class="am-form-field" name="memberName">
							<span class="am-input-group-btn">
            				<button class="am-btn am-btn-default" type="submit">按姓名搜索</button>
							</span>
					</div>
				</div>
				</form>
			</div>

			<div style="position:relative; height:400px; overflow:auto">
			<div class="am-g">
				<div class="am-u-sm-12">
					<form class="am-form">
						<table class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>
									<th class="table-id">ID</th>
									<th class="table-title">姓名</th>
									<th class="table-type">剩余课程</th>
									<th class="table-set">操作</th>
								</tr>
							</thead>
							<tbody>
								<tr th:each="user:${users}">
									<td th:text="${user.memberId}"></td>
									<td th:text="${user.memberName}"></td>
									<td th:text="${user.remainTimes}"></td>
									<td>
										<div class="am-btn-toolbar">
											<div class="am-btn-group am-btn-group-xs">

												<button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" data-toggle="modal" data-target="#my"><span class="am-icon-trash-o"></span> 编辑</button>
												<!-- 模态框（Modal） -->
												<div class="modal fade" id="my" tabindex="-1" role="dialog" aria-labelledby="myModalLabel9" aria-hidden="true">
													<div class="modal-dialog">
														<div class="modal-content">
															<div class="modal-header">
																<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
																	&times;
																</button>
																<h4 class="modal-title" id="myModalLabel9">
																	别动别动
																</h4>
															</div>
															<div class="modal-body">
																<div>
																	<form action="#">
																		<button type="button" class="btn btn-default" data-dismiss="modal">完成</button>
																	</form>

																</div>
															</div>
														</div><!-- /.modal-content -->
													</div><!-- /.modal -->
												</div>

												<button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" data-toggle="modal" th:data-target="'#change'+${user.memberId}"><span class="am-icon-trash-o"></span> 修改姓名</button>
												<!-- 模态框（Modal） -->
												<div class="modal fade" th:id="'change'+${user.memberId}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel11" aria-hidden="true">
													<div class="modal-dialog">
														<div class="modal-content">
															<div class="modal-header">
																<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
																	&times;
																</button>
																<h4 class="modal-title" id="myModalLabel11">
																	更改会员信息
																</h4>
															</div>
															<div class="modal-body">
																<span>原会员名：</span>
																<span th:text="${user.memberName}"></span>
																<div>
																	<form method="post" th:action="'/memberScheduling/changeMemberName/'+${user.memberId}">
																		<label for="changeUserInfo">变更为</label>
																		<input type="text" id="changeUserInfo" name="memberName">
																		<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
																		<input type="submit" class="btn btn-primary" text="确认">
																	</form>
																</div>
															</div>
														</div><!-- /.modal-content -->
													</div><!-- /.modal -->
												</div>


												<button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" data-toggle="modal" th:data-target="'#BeginCourse'+${user.memberId}"><span class="am-icon-trash-o"></span> 会员打卡上课</button>
												<!-- 模态框（Modal） -->
												<div class="modal fade" th:id="'BeginCourse'+${user.memberId}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
													<div class="modal-dialog">
														<div class="modal-content">
															<div class="modal-header">
																<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
																	&times;
																</button>
																<h4 class="modal-title" id="myModalLabel1">
																	会员打卡上课
																</h4>
															</div>
															<div class="modal-body">
																<span>会员：</span>
																<span th:text="${user.memberName}"></span>
																<span>来上课，是否确认？</span>
																<div>
																	<form method="post" th:action="'/memberScheduling/BeginClass/'+${user.memberId}">
																		<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
																		<input type="submit" class="btn btn-primary" text="确认">
																	</form>
																</div>
															</div>
														</div><!-- /.modal-content -->
													</div><!-- /.modal -->
												</div>

												<button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" data-toggle="modal" th:data-target="'#BuyCourse'+${user.memberId}"><span class="am-icon-trash-o"></span> 会员购买课程</button>
												<!-- 模态框（Modal） -->
												<div class="modal fade" th:id="'BuyCourse'+${user.memberId}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2" aria-hidden="true">
													<div class="modal-dialog">
														<div class="modal-content">
															<div class="modal-header">
																<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
																	&times
																</button>
																<h4 class="modal-title" id="myModalLabel2">
																	会员购买课程
																</h4>
															</div>
															<div class="modal-body">
																<span>会员：</span>
																<span th:text="${user.memberName}"></span>
																<div>
																	<form method="post" th:action="'/memberScheduling/BuyCourseTimes/'+${user.memberId}">
																		<label for="buyTimes">购买课程</label>
																		<input type="text" id="buyTimes" name="courseTimes">
																		<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
																		<input type="submit" class="btn btn-primary" text="购买">
																	</form>
																</div>
															</div>
														</div><!-- /.modal-content -->
													</div><!-- /.modal -->
												</div>

												<button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" data-toggle="modal" th:data-target="'#reviseCourse'+${user.memberId}"><span class="am-icon-trash-o"></span> 修改会员课程数</button>
												<!-- 模态框（Modal） -->
												<div class="modal fade" th:id="'reviseCourse'+${user.memberId}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel4" aria-hidden="true">
													<div class="modal-dialog">
														<div class="modal-content">
															<div class="modal-header">
																<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
																	&times
																</button>
																<h4 class="modal-title" id="myModalLabel4">
																	更改会员的课程数
																</h4>
															</div>
															<div class="modal-body">
																<span>会员：</span>
																<span th:text="${user.memberName}"></span>
																<span>原课程数</span>
																<span th:text="${user.remainTimes}"></span>
																<div>
																	<form method="post" th:action="'/memberScheduling/changeMemberCourseTimes/'+${user.memberId}">
																		<label for="buyTimes">修改课程数为</label>
																		<input type="text" id="changedTimes" name="changedCourseTimes">
																		<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
																		<input type="submit" class="btn btn-primary" text="确认">
																	</form>
																</div>
															</div>
														</div><!-- /.modal-content -->
													</div><!-- /.modal -->
												</div>

												<button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" data-toggle="modal" style="color: orangered" th:data-target="'#delete'+${user.memberId}"><span class="am-icon-trash-o"></span> 删除会员</button>
												<!-- 模态框（Modal） -->
												<div class="modal fade" th:id="'delete'+${user.memberId}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel12" aria-hidden="true">
													<div class="modal-dialog">
														<div class="modal-content">
															<div class="modal-header">
																<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
																	&times
																</button>
																<h4 class="modal-title" id="myModalLabel12">
																	删除会员
																</h4>
															</div>
															<div class="modal-body">
																<span style="color: red">删除会员：</span>
																<span th:text="${user.memberName}"></span>
																<span>剩余课程数：</span>
																<span th:text="${user.remainTimes}"></span>
																<div>
																	<form method="post" th:action="'/memberScheduling/deleteMember/'+${user.memberId}">
																		<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
																		<input type="submit" class="btn btn-primary" text="确认删除">
																	</form>
																</div>
															</div>
														</div><!-- /.modal-content -->
													</div><!-- /.modal -->
												</div>

											</div>
										</div>
									</td>
								</tr>
							</tbody>
						</table>
					</form>
				</div>
			</div>
		</div>
		</div>
	</body>
</html>